package com.tdkj.model.user;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.tdkj.model.base.BaseEntity;
import com.tdkj.model.common.BeanPhotoCategory;
import com.tdkj.model.enterprisezone.BeanEnterprise;
import com.tdkj.model.enterprisezone.BeanEnterpriseZone;
import com.tdkj.model.financial.BeanFinancialAccount;
import com.tdkj.model.information.BeanBaseInfo;
import com.tdkj.model.information.BeanExpert;
import com.tdkj.model.information.BeanInfoComment;
import com.tdkj.model.information.BeanInfoReply;
import com.tdkj.model.risevalue.BeanAdvertAuctionInfo;
import com.tdkj.model.risevalue.BeanPlateQuotationUseInfo;
import com.tdkj.model.risevalue.BeanPlateSMSUseInfo;
import com.tdkj.model.shop.BeanCreditRating;
import com.tdkj.model.shop.BeanOrderConsigneeInfo;
import com.tdkj.model.shop.BeanShop;
import com.tdkj.model.shop.BeanShoppingCart;
import com.tdkj.model.website.BeanComplaint;
import com.tdkj.model.website.BeanProtocolDetail;

/**
 * XnkyUser entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "xnky_user")
public class BeanUser extends BaseEntity {
	private static final long serialVersionUID = -3107998073568933275L;
	// Fields
	
	//账号基本信息，作为在网站的标志
	private String username;
	private int creditScore;
	private BeanCreditRating creditRating;
	private BeanUserLevel userLevel;
	private BeanShoppingCart shoppingCart;
	
	private int experience;
	
	//账号安全信息
	private String userpassword;
	private String pwdquestion;
	private String pwdanswer;
	
	//店铺
	private BeanShop shop;
	
	//企业
	private BeanEnterprise enterprise;
	private BeanEnterpriseZone enterpriseZone;

	//关联
	private List<BeanFriendCategory> friendCategorys = new ArrayList<BeanFriendCategory>();
	private List<BeanPhotoCategory> photocategorys = new ArrayList<BeanPhotoCategory>();
	private List<BeanInfoReply> replys = new ArrayList<BeanInfoReply>();
	private Set<BeanProtocolDetail> protocolDetails = new HashSet<BeanProtocolDetail>(0);
	private Set<BeanComplaint> complaints = new HashSet<BeanComplaint>(0);
	private Set<BeanAdminSilvercoin> adminSilvercoins = new HashSet<BeanAdminSilvercoin>(0);
	private Set<BeanInfoComment> infoComments = new HashSet<BeanInfoComment>(0);
	private Set<BeanBaseInfo> baseInfo = new HashSet<BeanBaseInfo>(0);
	private List<BeanAdvertAuctionInfo> auctioninfos;
	private List<BeanOrderConsigneeInfo> consigneeInfos;

	// 注册IP
	private String registIP;
	// 注册时间
	private Timestamp registDateTime;
	// 状态 0:正常 1:冻结
	private int state;
	// 专家
	private boolean expert;
	private BeanExpert beanExpert;
	// 认证通过
	private boolean certification;
	// 用户登录名
	private String userLoginName;
	// 呢称
	private String nikeName;
	// 金融中心账号
	private BeanFinancialAccount financialAccount;
	// 账号 0:个人 1：企业
	private int accountType;
	//邮箱是否验证
	private boolean verificationEmail;
	
	
	// 增值，使用信息
	private List<BeanPlateQuotationUseInfo> quotationUseInfos;
	private List<BeanPlateSMSUseInfo> SMSUseInfos;
	
	private BeanUserPersonal personal;

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getUserpassword() {
		return this.userpassword;
	}

	public void setUserpassword(String userpassword) {
		this.userpassword = userpassword;
	}

	public String getPwdquestion() {
		return this.pwdquestion;
	}

	public void setPwdquestion(String pwdquestion) {
		this.pwdquestion = pwdquestion;
	}

	public String getPwdanswer() {
		return this.pwdanswer;
	}

	public void setPwdanswer(String pwdanswer) {
		this.pwdanswer = pwdanswer;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<BeanProtocolDetail> getProtocolDetails() {
		return this.protocolDetails;
	}

	public void setProtocolDetails(Set<BeanProtocolDetail> protocolDetails) {
		this.protocolDetails = protocolDetails;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<BeanComplaint> getComplaints() {
		return this.complaints;
	}

	public void setComplaints(Set<BeanComplaint> complaints) {
		this.complaints = complaints;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<BeanInfoReply> getReplys() {
		return replys;
	}

	public void setReplys(List<BeanInfoReply> replys) {
		this.replys = replys;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<BeanAdvertAuctionInfo> getAuctioninfos() {
		return auctioninfos;
	}

	public void setAuctioninfos(List<BeanAdvertAuctionInfo> auctioninfos) {
		this.auctioninfos = auctioninfos;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<BeanFriendCategory> getFriendCategorys() {
		return friendCategorys;
	}

	public void setFriendCategorys(List<BeanFriendCategory> friendCategorys) {
		this.friendCategorys = friendCategorys;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public List<BeanPhotoCategory> getPhotocategorys() {
		return photocategorys;
	}

	public void setPhotocategorys(List<BeanPhotoCategory> photocategorys) {
		this.photocategorys = photocategorys;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<BeanAdminSilvercoin> getAdminSilvercoins() {
		return this.adminSilvercoins;
	}

	public void setAdminSilvercoins(Set<BeanAdminSilvercoin> websiteNotices) {
		this.adminSilvercoins = websiteNotices;
	}

	@ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY)
	@JoinColumn(name = "user_level_id")
	public BeanUserLevel getUserLevel() {
		return this.userLevel;
	}

	public void setUserLevel(BeanUserLevel userLevel) {
		this.userLevel = userLevel;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<BeanInfoComment> getInfoComments() {
		return infoComments;
	}

	public void setInfoComments(Set<BeanInfoComment> infoComments) {
		this.infoComments = infoComments;
	}

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(name = "enterprisezone_id")
	public BeanEnterpriseZone getEnterpriseZone() {
		return enterpriseZone;
	}

	public void setEnterpriseZone(BeanEnterpriseZone enterpriseZone) {
		this.enterpriseZone = enterpriseZone;
	}

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(name = "enterprise_id")
	public BeanEnterprise getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(BeanEnterprise enterprise) {
		this.enterprise = enterprise;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<BeanBaseInfo> getBaseInfo() {
		return baseInfo;
	}

	public void setBaseInfo(Set<BeanBaseInfo> baseInfo) {
		this.baseInfo = baseInfo;
	}

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(name = "shop_id")
	public BeanShop getShop() {
		return shop;
	}

	public void setShop(BeanShop shop) {
		this.shop = shop;
	}

	public int getCreditScore() {
		return creditScore;
	}

	public void setCreditScore(int creditScore) {
		this.creditScore = creditScore;
	}

	@OneToOne(fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
	@JoinColumn(name = "shoppingCart_id")
	public BeanShoppingCart getShoppingCart() {
		return shoppingCart;
	}

	/**
	 * @param shoppingCart
	 *            the shoppingCart to set
	 */
	public void setShoppingCart(BeanShoppingCart shoppingCart) {
		this.shoppingCart = shoppingCart;
	}

	/**
	 * @return the consigneeInfos
	 */
	@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL }, mappedBy = "user")
	public List<BeanOrderConsigneeInfo> getConsigneeInfos() {
		return consigneeInfos;
	}

	/**
	 * @param consigneeInfos
	 *            the consigneeInfos to set
	 */
	public void setConsigneeInfos(List<BeanOrderConsigneeInfo> consigneeInfos) {
		this.consigneeInfos = consigneeInfos;
	}

	public String getRegistIP() {
		return registIP;
	}

	public void setRegistIP(String registIP) {
		this.registIP = registIP;
	}

	public Timestamp getRegistDateTime() {
		return registDateTime;
	}

	public void setRegistDateTime(Timestamp registDateTime) {
		this.registDateTime = registDateTime;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public boolean isExpert() {
		return expert;
	}

	public void setExpert(boolean expert) {
		this.expert = expert;
	}

	public boolean isCertification() {
		return certification;
	}

	public void setCertification(boolean certification) {
		this.certification = certification;
	}

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public BeanExpert getBeanExpert() {
		return beanExpert;
	}

	public void setBeanExpert(BeanExpert beanExpert) {
		this.beanExpert = beanExpert;
	}

	public String getUserLoginName() {
		return userLoginName;
	}

	public void setUserLoginName(String userLoginName) {
		this.userLoginName = userLoginName;
	}

	public String getNikeName() {
		return nikeName;
	}

	public void setNikeName(String nikeName) {
		this.nikeName = nikeName;
	}

	@OneToOne(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
	@JoinColumn(name = "financial_account_id")
	public BeanFinancialAccount getFinancialAccount() {
		return financialAccount;
	}

	public void setFinancialAccount(BeanFinancialAccount financialAccount) {
		this.financialAccount = financialAccount;
	}

	public int getAccountType() {
		return accountType;
	}

	public void setAccountType(int accountType) {
		this.accountType = accountType;
	}

	@OneToMany(cascade={CascadeType.REFRESH}, fetch=FetchType.LAZY, mappedBy="user")
	public List<BeanPlateQuotationUseInfo> getQuotationUseInfos() {
		return quotationUseInfos;
	}

	public void setQuotationUseInfos(
			List<BeanPlateQuotationUseInfo> quotationUseInfos) {
		this.quotationUseInfos = quotationUseInfos;
	}

	
	@OneToMany(cascade={CascadeType.REFRESH}, fetch=FetchType.LAZY, mappedBy="user")
	public List<BeanPlateSMSUseInfo> getSMSUseInfos() {
		return SMSUseInfos;
	}

	public void setSMSUseInfos(List<BeanPlateSMSUseInfo> sMSUseInfos) {
		SMSUseInfos = sMSUseInfos;
	}

	@OneToOne(cascade={CascadeType.ALL}, fetch=FetchType.LAZY)
	@JoinColumn(name="personal_id")
	public BeanUserPersonal getPersonal() {
		return personal;
	}

	public void setPersonal(BeanUserPersonal personal) {
		this.personal = personal;
	}

	public int getExperience() {
		return experience;
	}

	public void setExperience(int experience) {
		this.experience = experience;
	}

	/**
	 * @return the verificationEmail
	 */
	public boolean isVerificationEmail() {
		return verificationEmail;
	}

	/**
	 * @param verificationEmail the verificationEmail to set
	 */
	public void setVerificationEmail(boolean verificationEmail) {
		this.verificationEmail = verificationEmail;
	}
	@ManyToOne(cascade={CascadeType.REFRESH}, fetch=FetchType.LAZY)
	@JoinColumn(name="credit_rating_id")
	public BeanCreditRating getCreditRating() {
		return creditRating;
	}

	public void setCreditRating(BeanCreditRating creditRating) {
		this.creditRating = creditRating;
	}
	
}